#include <cstdio>

int main() {
    char t;
    double a[12][12];

    scanf("%c", &t);
    for (int i = 0; i < 12; i++) {
        for (int j = 0; j < 12; j++) {
            scanf("%lf", &a[i][j]);
        }
    }

    double s = 0, c = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j <= 10 - i; j++) {
            c += 1;
            s += a[i][j];
        }
    }
    if (t == 'S') {
        printf("%.1lf\n", s);
    } else {
        printf("%.1lf\n", s / c);
    }

    return 0;
}
